<?php
/**
 * Created by PhpStorm.
 * User: MACHENIKE
 * Date: 2017/7/14
 * Time: 11:58
 */

namespace Pay;

use Org\Payment\pay_message;

class Payment_request extends pay_message {

    public $order_no = 0;
    public $amount_money = 0;
    public $total_money = 0;
    private $call_url = 'https://xly.xiarikui.cn/Home/Cart/callback';
    private $redirect_url = 'https://xly.xiarikui.cn/Home/User/order';

    /**
     * 保存订单号和总金额
     * Payment_request constructor.
     * @param $order_num
     * @param $amount_money
     * @param $total_money
     */
    public function __construct($order_num, $amount_money, $total_money)
    {
        parent::__construct();
        $this->order_no = $order_num;
        $this->total_money   = $total_money;
        $this->amount_money   = $amount_money;
    }

    /**
     * 设置Data数据
     * @return array
     */
    public function set_data()
    {
        // TODO: Implement set_data() method.
        $OrderNo    = $this->order_no;
        $Channel    = '1203';
        $ShopId     = '337186876979417088';
        $DeviceId   = '';
        $Subject    = '鲜乐园';
        $Amount     = $this->total_money;
        $DiscountAmount = $this->amount_money;
        $CallbackUrl = $this->call_url;
        $RedirectUrl = $this->redirect_url;

        return compact(
            'OrderNo','ShopId','DeviceId','Channel','Amount','Subject',
            'DiscountAmount','CallbackUrl','RedirectUrl'
        );
    }

    /**
     * 设置optType
     * @return string
     */
    public function set_optType()
    {
        return 'FT_S_P104';
        // TODO: Implement set_optType() method.
    }
}